package me.ezitku.JsBridge

import android.webkit.WebView
import me.ezitku.JsBridge.Handler.JsBridgeInvocationHandler
import java.lang.reflect.Proxy

/**
 * Created by yurqi on 17-10-19.
 */
class JsBridge(var cls: Class<*>, var webView: WebView) {


    fun <T> instance(): T {
//        if (!cls.isInterface) {
//            return null!!
//        }
        var handler = JsBridgeInvocationHandler(webView)
        return Proxy.newProxyInstance(cls.classLoader, arrayOf(cls), handler) as T
    }

}